home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 41 / RISING.iso / Speciale WinAmp / WinAMP173.exe / FRONTEND.TXT next >
Text File  |  1998-02-10  |  6KB  |  180 lines

  1. This file is only useful for people who are writing frontends for Winamp.
  2. Actually, it's useful for plugin authors too.
  3.  
  4.  
  5. There are some useful notes for VB programmers at the end of this file.
  6.  
  7.  
  8.  
  9. Psuedo IPC for frontends for Winamp v1.55+ (< 2.0)
  10.  
  11. This document is horribly [de]organized, and is pretty much just hacked
  12. together for people to use.
  13.  
  14. Winamp's window is found using:
  15. hwnd_winamp = FindWindow("Winamp v1.x",NULL);
  16.  
  17. #define WM_WA_IPC WM_USER
  18. // messages are sent to the winamp window using:
  19. result = SendMessage(hwnd_winamp,WM_WA_IPC,command_data,command);
  20.  
  21.  
  22. /* Messages available to send */
  23.  
  24. #define IPC_GETVERSION 0
  25. /*
  26.     IPC_GETVERSION is sent to the window, and the return value is the version
  27.         Version 1.55 = 0x1551
  28.         Version 1.6b = 0x16A0
  29.         Version 1.60 = 0x16AF
  30.         Version 1.61 = 0x16B0
  31.         Version 1.62 = 0x16B1
  32.         Version 1.64 = 0x16B3
  33.         Version 1.666 = 0x16B4
  34.         Version 1.69 = 0x16B5
  35.         Version 1.70 = 0x1700
  36.         Version 1.72 = 0x1702
  37.         Version 1.72 = 0x1703
  38.     the command_data parameter is 0.
  39.     so, 
  40.     if (SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETVERSION) != 0x1551)
  41.         MessageBox(NULL,"Error, Winamp 1.55 not found","Warning",MB_OK);
  42. */
  43.  
  44.  
  45. #define IPC_PLAYFILE 100
  46. /*
  47.     IPC_PLAYFILE is sent to the window for each char of a null terminated string of a file to ADD
  48.     to the playlist (it doesn't change the playing status). Note, if you pass a file with the extension
  49.     ".m3u" it will be treated as a playlist.
  50.     for example:
  51.         char *file = "C:\\download\\booga.mp3";
  52.         int x;
  53.         for (x = 0; x <= strlen(file); x ++)
  54.             PostMessage(hwnd_winamp,WM_WA_IPC,(LPARAM)file[x],IPC_PLAYFILE);
  55.     will add "C:\download\booga.mp3" to the end of the playlist
  56. */
  57.  
  58. #define IPC_DELETE 101
  59. /* 
  60.     IPC_DELETE deletes the internal Winamp playlist.
  61.         SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_DELETE);
  62. */
  63.  
  64. #define IPC_STARTPLAY 102
  65. /* 
  66.     IPC_STARTPLAY starts the playing.
  67.         SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_STARTPLAY);
  68. */
  69.  
  70. #define IPC_CHDIR 103
  71. /*
  72.     IPC_CHDIR is sent to the window for each char of a null terminated string of a directory to change to
  73.     for example:
  74.         char *dir = "C:\\Download";
  75.         int x;
  76.         for (x = 0; x <= strlen(file); x ++)
  77.             PostMessage(hwnd_winamp,WM_WA_IPC,(LPARAM)dir[x],IPC_PLAYFILE);
  78.     will change the winamp process to "C:\download" (useful for relative pathnames and loading playlists)
  79.  
  80. */
  81. #define IPC_ISPLAYING 104
  82. /*
  83.     IPC_ISPLAYING returns the status of playback.
  84.     If it returns 1, it is playing. if it returns 3, it is paused, if it returns 0, it is not playing.
  85.     If it returns something other than 1,3,or 0, something is screwed.
  86.     isplaying = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_ISPLAYING);
  87. */
  88.  
  89.  
  90. #define IPC_GETOUTPUTTIME 105
  91. /*
  92.     IPC_GETOUTPUTTIME returns the position in milliseconds of the 
  93.           current song (lParam = 0), or the song length, in seconds (lParam = 1).
  94.     Returns -1 if not playing or error.
  95.         
  96.     song_pos = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETOUTPUTTIME);
  97.     song_len = SendMessage(hwnd_winamp,WM_WA_IPC,1,IPC_GETOUTPUTTIME);
  98. */
  99.  
  100. #define IPC_JUMPTOTIME 106
  101. /*
  102.         *ONLY AVAILABLE IN v1.60+*
  103.     IPC_JUMPTOTIME sets the position in milliseconds of the current song (approximately)
  104.     Returns -1 if not playing, 1 on eof, or 0 if successful
  105.     SendMessage(hwnd_winamp,WM_WA_IPC,new_song_pos,IPC_JUMPTOTIME);
  106. */
  107. #define IPC_WRITEPLAYLIST 120
  108. /*
  109.         *ONLY AVAILABLE IN v1.666+*
  110.     IPC_WRITEPLAYLIST writes the current playlist to <winampdir>\\Winamp.pl
  111.     int cursong =  SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_WRITEPLAYLIST);
  112.     (cursong is the index of the current song in the playlist)
  113. */
  114.  
  115.  
  116. // THESE MIGHT CHANGE in the future :)
  117. //Also, you can send standard WM_COMMAND messages to the Winamp window (for other controls), including
  118. // Send using SendMessage(hwnd_winamp,WM_COMMAND,WINAMP_OPTIONS_EQ/*orwhatever*/,0);
  119.  
  120. // toggles the EQ window
  121. #define WINAMP_OPTIONS_EQ               40036
  122. // toggles the playlist window
  123. #define WINAMP_OPTIONS_PLEDIT           40040
  124. // turns the volume up a little
  125. #define WINAMP_VOLUMEUP                 40058
  126. // turns the volume down a little
  127. #define WINAMP_VOLUMEDOWN               40059
  128. // fast forwards 5 seconds
  129. #define WINAMP_FFWD5S                   40060
  130. // rewinds 5 seconds
  131. #define WINAMP_REW5S                    40061
  132. // the following are the five main control buttons, with optionally shift or control pressed
  133. // (for the exact functions of each, just try it out)
  134. #define WINAMP_BUTTON1                  40044
  135. #define WINAMP_BUTTON2                  40045
  136. #define WINAMP_BUTTON3                  40046
  137. #define WINAMP_BUTTON4                  40047
  138. #define WINAMP_BUTTON5                  40048
  139. #define WINAMP_BUTTON1_SHIFT            40144
  140. #define WINAMP_BUTTON2_SHIFT            40145
  141. #define WINAMP_BUTTON3_SHIFT            40146
  142. #define WINAMP_BUTTON4_SHIFT            40147
  143. #define WINAMP_BUTTON5_SHIFT            40148
  144. #define WINAMP_BUTTON1_CTRL             40154
  145. #define WINAMP_BUTTON2_CTRL             40155
  146. #define WINAMP_BUTTON3_CTRL             40156
  147. #define WINAMP_BUTTON4_CTRL             40157
  148. #define WINAMP_BUTTON5_CTRL             40158
  149.  
  150. // always goes to the previous song (unlike button 1), 1.666+
  151. #define WINAMP_PREVSONG                    40198
  152.  
  153. // pops up the load file(s) box
  154. #define WINAMP_FILE_PLAY                40029
  155. // pops up the preferences
  156. #define WINAMP_OPTIONS_PREFS            40012
  157. // toggles always on top
  158. #define WINAMP_OPTIONS_AOT              40019
  159. // pops up the about box :)
  160. #define WINAMP_HELP_ABOUT               40041
  161.  
  162.  
  163. /* A little about Visual Basic
  164. In VB, the SendMessage function does not work, you must use the SendMessageTimeout. 
  165. Otherwise, VB will not wait for WinAmp to return a value. Here's an example...
  166.     Dim Success as Long
  167.     Dim ReturnValue As Long
  168.     Success = SendMessageTimeout(WinampHandle, WM_USER, 0, 104, SMTO_BLOCK, 1000, ReturnValue)
  169.     MsgBox (ReturnValue)
  170. If you are sending commands, use this format;
  171.     Dim Success as Long
  172.     Success = PostMessage(WinampHandle, WM_COMMAND, 40022, 0)
  173. // -VB notes by Amal G.
  174. */
  175.  
  176.  
  177.  
  178. // hope this helps, 
  179. // -Justin [justin@nullsoft.com]
  180.